package cz.vutbr.fit.xzemko01.tfmcbs.diagram.navigator;

import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.jface.viewers.ITreePathLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.ViewerLabel;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.navigator.ICommonContentExtensionSite;
import org.eclipse.ui.navigator.ICommonLabelProvider;

import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.ArtifactEditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.ArtifactNameEditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.CompositeComponent2EditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.CompositeComponentEditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.CompositeComponentName2EditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.CompositeComponentNameEditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.DelegateEditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.DependencyEditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.DependencyNameEditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.GeneralizationEditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.GeneralizationNameEditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.Interface2EditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.InterfaceEditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.InterfaceName2EditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.InterfaceNameEditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.ManifestationEditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.ManifestationNameEditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.ModelEditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.ProvidingPortEditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.ProvidingPortNameEditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.RealizationEditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.RealizationNameEditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.RequiringPortEditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.RequiringPortNameEditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.SimpleComponent2EditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.SimpleComponentEditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.SimpleComponentName2EditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.SimpleComponentNameEditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.UsageEditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.edit.parts.UsageNameEditPart;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.part.ComponentBasedSystemDiagramEditorPlugin;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.part.ComponentBasedSystemVisualIDRegistry;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.providers.ComponentBasedSystemElementTypes;
import cz.vutbr.fit.xzemko01.tfmcbs.diagram.providers.ComponentBasedSystemParserProvider;
import cz.vutbr.fit.xzemko01.tfmcbs.model.Delegate;
import cz.vutbr.fit.xzemko01.tfmcbs.model.Model;

/**
 * @generated
 */
public class ComponentBasedSystemNavigatorLabelProvider extends LabelProvider
		implements ICommonLabelProvider, ITreePathLabelProvider {

	/**
	 * @generated
	 */
	static {
		ComponentBasedSystemDiagramEditorPlugin
				.getInstance()
				.getImageRegistry()
				.put("Navigator?UnknownElement", ImageDescriptor.getMissingImageDescriptor()); //$NON-NLS-1$
		ComponentBasedSystemDiagramEditorPlugin
				.getInstance()
				.getImageRegistry()
				.put("Navigator?ImageNotFound", ImageDescriptor.getMissingImageDescriptor()); //$NON-NLS-1$
	}

	/**
	 * @generated
	 */
	public void updateLabel(ViewerLabel label, TreePath elementPath) {
		Object element = elementPath.getLastSegment();
		if (element instanceof ComponentBasedSystemNavigatorItem
				&& !isOwnView(((ComponentBasedSystemNavigatorItem) element)
						.getView())) {
			return;
		}
		label.setText(getText(element));
		label.setImage(getImage(element));
	}

	/**
	 * @generated
	 */
	public Image getImage(Object element) {
		if (element instanceof ComponentBasedSystemNavigatorGroup) {
			ComponentBasedSystemNavigatorGroup group = (ComponentBasedSystemNavigatorGroup) element;
			return ComponentBasedSystemDiagramEditorPlugin.getInstance()
					.getBundledImage(group.getIcon());
		}

		if (element instanceof ComponentBasedSystemNavigatorItem) {
			ComponentBasedSystemNavigatorItem navigatorItem = (ComponentBasedSystemNavigatorItem) element;
			if (!isOwnView(navigatorItem.getView())) {
				return super.getImage(element);
			}
			return getImage(navigatorItem.getView());
		}

		return super.getImage(element);
	}

	/**
	 * @generated
	 */
	public Image getImage(View view) {
		switch (ComponentBasedSystemVisualIDRegistry.getVisualID(view)) {
		case CompositeComponentEditPart.VISUAL_ID:
			return getImage(
					"Navigator?TopLevelNode?http://www.fit.vutbr.cz/stud/xzemko01/tool-for-modelling-component-based-systems?CompositeComponent", ComponentBasedSystemElementTypes.CompositeComponent_2002); //$NON-NLS-1$
		case RealizationEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Link?http://www.fit.vutbr.cz/stud/xzemko01/tool-for-modelling-component-based-systems?Realization", ComponentBasedSystemElementTypes.Realization_4003); //$NON-NLS-1$
		case ModelEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Diagram?http://www.fit.vutbr.cz/stud/xzemko01/tool-for-modelling-component-based-systems?Model", ComponentBasedSystemElementTypes.Model_1000); //$NON-NLS-1$
		case DelegateEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Link?http://www.fit.vutbr.cz/stud/xzemko01/tool-for-modelling-component-based-systems?Delegate", ComponentBasedSystemElementTypes.Delegate_4006); //$NON-NLS-1$
		case DependencyEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Link?http://www.fit.vutbr.cz/stud/xzemko01/tool-for-modelling-component-based-systems?Dependency", ComponentBasedSystemElementTypes.Dependency_4001); //$NON-NLS-1$
		case SimpleComponent2EditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://www.fit.vutbr.cz/stud/xzemko01/tool-for-modelling-component-based-systems?SimpleComponent", ComponentBasedSystemElementTypes.SimpleComponent_3001); //$NON-NLS-1$
		case InterfaceEditPart.VISUAL_ID:
			return getImage(
					"Navigator?TopLevelNode?http://www.fit.vutbr.cz/stud/xzemko01/tool-for-modelling-component-based-systems?Interface", ComponentBasedSystemElementTypes.Interface_2004); //$NON-NLS-1$
		case ProvidingPortEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://www.fit.vutbr.cz/stud/xzemko01/tool-for-modelling-component-based-systems?ProvidingPort", ComponentBasedSystemElementTypes.ProvidingPort_3004); //$NON-NLS-1$
		case UsageEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Link?http://www.fit.vutbr.cz/stud/xzemko01/tool-for-modelling-component-based-systems?Usage", ComponentBasedSystemElementTypes.Usage_4004); //$NON-NLS-1$
		case Interface2EditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://www.fit.vutbr.cz/stud/xzemko01/tool-for-modelling-component-based-systems?Interface", ComponentBasedSystemElementTypes.Interface_3003); //$NON-NLS-1$
		case SimpleComponentEditPart.VISUAL_ID:
			return getImage(
					"Navigator?TopLevelNode?http://www.fit.vutbr.cz/stud/xzemko01/tool-for-modelling-component-based-systems?SimpleComponent", ComponentBasedSystemElementTypes.SimpleComponent_2001); //$NON-NLS-1$
		case ManifestationEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Link?http://www.fit.vutbr.cz/stud/xzemko01/tool-for-modelling-component-based-systems?Manifestation", ComponentBasedSystemElementTypes.Manifestation_4002); //$NON-NLS-1$
		case CompositeComponent2EditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://www.fit.vutbr.cz/stud/xzemko01/tool-for-modelling-component-based-systems?CompositeComponent", ComponentBasedSystemElementTypes.CompositeComponent_3002); //$NON-NLS-1$
		case RequiringPortEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://www.fit.vutbr.cz/stud/xzemko01/tool-for-modelling-component-based-systems?RequiringPort", ComponentBasedSystemElementTypes.RequiringPort_3005); //$NON-NLS-1$
		case ArtifactEditPart.VISUAL_ID:
			return getImage(
					"Navigator?TopLevelNode?http://www.fit.vutbr.cz/stud/xzemko01/tool-for-modelling-component-based-systems?Artifact", ComponentBasedSystemElementTypes.Artifact_2003); //$NON-NLS-1$
		case GeneralizationEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Link?http://www.fit.vutbr.cz/stud/xzemko01/tool-for-modelling-component-based-systems?Generalization", ComponentBasedSystemElementTypes.Generalization_4005); //$NON-NLS-1$
		}
		return getImage("Navigator?UnknownElement", null); //$NON-NLS-1$
	}

	/**
	 * @generated
	 */
	private Image getImage(String key, IElementType elementType) {
		ImageRegistry imageRegistry = ComponentBasedSystemDiagramEditorPlugin
				.getInstance().getImageRegistry();
		Image image = imageRegistry.get(key);
		if (image == null
				&& elementType != null
				&& ComponentBasedSystemElementTypes
						.isKnownElementType(elementType)) {
			image = ComponentBasedSystemElementTypes.getImage(elementType);
			imageRegistry.put(key, image);
		}

		if (image == null) {
			image = imageRegistry.get("Navigator?ImageNotFound"); //$NON-NLS-1$
			imageRegistry.put(key, image);
		}
		return image;
	}

	/**
	 * @generated
	 */
	public String getText(Object element) {
		if (element instanceof ComponentBasedSystemNavigatorGroup) {
			ComponentBasedSystemNavigatorGroup group = (ComponentBasedSystemNavigatorGroup) element;
			return group.getGroupName();
		}

		if (element instanceof ComponentBasedSystemNavigatorItem) {
			ComponentBasedSystemNavigatorItem navigatorItem = (ComponentBasedSystemNavigatorItem) element;
			if (!isOwnView(navigatorItem.getView())) {
				return null;
			}
			return getText(navigatorItem.getView());
		}

		return super.getText(element);
	}

	/**
	 * @generated
	 */
	public String getText(View view) {
		if (view.getElement() != null && view.getElement().eIsProxy()) {
			return getUnresolvedDomainElementProxyText(view);
		}
		switch (ComponentBasedSystemVisualIDRegistry.getVisualID(view)) {
		case CompositeComponentEditPart.VISUAL_ID:
			return getCompositeComponent_2002Text(view);
		case RealizationEditPart.VISUAL_ID:
			return getRealization_4003Text(view);
		case ModelEditPart.VISUAL_ID:
			return getModel_1000Text(view);
		case DelegateEditPart.VISUAL_ID:
			return getDelegate_4006Text(view);
		case DependencyEditPart.VISUAL_ID:
			return getDependency_4001Text(view);
		case SimpleComponent2EditPart.VISUAL_ID:
			return getSimpleComponent_3001Text(view);
		case InterfaceEditPart.VISUAL_ID:
			return getInterface_2004Text(view);
		case ProvidingPortEditPart.VISUAL_ID:
			return getProvidingPort_3004Text(view);
		case UsageEditPart.VISUAL_ID:
			return getUsage_4004Text(view);
		case Interface2EditPart.VISUAL_ID:
			return getInterface_3003Text(view);
		case SimpleComponentEditPart.VISUAL_ID:
			return getSimpleComponent_2001Text(view);
		case ManifestationEditPart.VISUAL_ID:
			return getManifestation_4002Text(view);
		case CompositeComponent2EditPart.VISUAL_ID:
			return getCompositeComponent_3002Text(view);
		case RequiringPortEditPart.VISUAL_ID:
			return getRequiringPort_3005Text(view);
		case ArtifactEditPart.VISUAL_ID:
			return getArtifact_2003Text(view);
		case GeneralizationEditPart.VISUAL_ID:
			return getGeneralization_4005Text(view);
		}
		return getUnknownElementText(view);
	}

	/**
	 * @generated
	 */
	private String getDependency_4001Text(View view) {
		IParser parser = ComponentBasedSystemParserProvider.getParser(
				ComponentBasedSystemElementTypes.Dependency_4001, view
						.getElement() != null ? view.getElement() : view,
				ComponentBasedSystemVisualIDRegistry
						.getType(DependencyNameEditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			ComponentBasedSystemDiagramEditorPlugin.getInstance().logError(
					"Parser was not found for label " + 6001); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getUsage_4004Text(View view) {
		IParser parser = ComponentBasedSystemParserProvider.getParser(
				ComponentBasedSystemElementTypes.Usage_4004,
				view.getElement() != null ? view.getElement() : view,
				ComponentBasedSystemVisualIDRegistry
						.getType(UsageNameEditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			ComponentBasedSystemDiagramEditorPlugin.getInstance().logError(
					"Parser was not found for label " + 6006); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getProvidingPort_3004Text(View view) {
		IParser parser = ComponentBasedSystemParserProvider.getParser(
				ComponentBasedSystemElementTypes.ProvidingPort_3004, view
						.getElement() != null ? view.getElement() : view,
				ComponentBasedSystemVisualIDRegistry
						.getType(ProvidingPortNameEditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			ComponentBasedSystemDiagramEditorPlugin.getInstance().logError(
					"Parser was not found for label " + 5006); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getCompositeComponent_3002Text(View view) {
		IParser parser = ComponentBasedSystemParserProvider.getParser(
				ComponentBasedSystemElementTypes.CompositeComponent_3002, view
						.getElement() != null ? view.getElement() : view,
				ComponentBasedSystemVisualIDRegistry
						.getType(CompositeComponentName2EditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			ComponentBasedSystemDiagramEditorPlugin.getInstance().logError(
					"Parser was not found for label " + 5010); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getRealization_4003Text(View view) {
		IParser parser = ComponentBasedSystemParserProvider.getParser(
				ComponentBasedSystemElementTypes.Realization_4003, view
						.getElement() != null ? view.getElement() : view,
				ComponentBasedSystemVisualIDRegistry
						.getType(RealizationNameEditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			ComponentBasedSystemDiagramEditorPlugin.getInstance().logError(
					"Parser was not found for label " + 6005); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getInterface_2004Text(View view) {
		IParser parser = ComponentBasedSystemParserProvider.getParser(
				ComponentBasedSystemElementTypes.Interface_2004, view
						.getElement() != null ? view.getElement() : view,
				ComponentBasedSystemVisualIDRegistry
						.getType(InterfaceNameEditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			ComponentBasedSystemDiagramEditorPlugin.getInstance().logError(
					"Parser was not found for label " + 5016); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getArtifact_2003Text(View view) {
		IParser parser = ComponentBasedSystemParserProvider.getParser(
				ComponentBasedSystemElementTypes.Artifact_2003, view
						.getElement() != null ? view.getElement() : view,
				ComponentBasedSystemVisualIDRegistry
						.getType(ArtifactNameEditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			ComponentBasedSystemDiagramEditorPlugin.getInstance().logError(
					"Parser was not found for label " + 5014); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getGeneralization_4005Text(View view) {
		IParser parser = ComponentBasedSystemParserProvider.getParser(
				ComponentBasedSystemElementTypes.Generalization_4005, view
						.getElement() != null ? view.getElement() : view,
				ComponentBasedSystemVisualIDRegistry
						.getType(GeneralizationNameEditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			ComponentBasedSystemDiagramEditorPlugin.getInstance().logError(
					"Parser was not found for label " + 6007); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getSimpleComponent_2001Text(View view) {
		IParser parser = ComponentBasedSystemParserProvider.getParser(
				ComponentBasedSystemElementTypes.SimpleComponent_2001, view
						.getElement() != null ? view.getElement() : view,
				ComponentBasedSystemVisualIDRegistry
						.getType(SimpleComponentNameEditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			ComponentBasedSystemDiagramEditorPlugin.getInstance().logError(
					"Parser was not found for label " + 5001); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getModel_1000Text(View view) {
		Model domainModelElement = (Model) view.getElement();
		if (domainModelElement != null) {
			return domainModelElement.getTitle();
		} else {
			ComponentBasedSystemDiagramEditorPlugin.getInstance().logError(
					"No domain element for view with visualID = " + 1000); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getManifestation_4002Text(View view) {
		IParser parser = ComponentBasedSystemParserProvider.getParser(
				ComponentBasedSystemElementTypes.Manifestation_4002, view
						.getElement() != null ? view.getElement() : view,
				ComponentBasedSystemVisualIDRegistry
						.getType(ManifestationNameEditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			ComponentBasedSystemDiagramEditorPlugin.getInstance().logError(
					"Parser was not found for label " + 6003); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getSimpleComponent_3001Text(View view) {
		IParser parser = ComponentBasedSystemParserProvider.getParser(
				ComponentBasedSystemElementTypes.SimpleComponent_3001, view
						.getElement() != null ? view.getElement() : view,
				ComponentBasedSystemVisualIDRegistry
						.getType(SimpleComponentName2EditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			ComponentBasedSystemDiagramEditorPlugin.getInstance().logError(
					"Parser was not found for label " + 5003); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getRequiringPort_3005Text(View view) {
		IParser parser = ComponentBasedSystemParserProvider.getParser(
				ComponentBasedSystemElementTypes.RequiringPort_3005, view
						.getElement() != null ? view.getElement() : view,
				ComponentBasedSystemVisualIDRegistry
						.getType(RequiringPortNameEditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			ComponentBasedSystemDiagramEditorPlugin.getInstance().logError(
					"Parser was not found for label " + 5008); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getDelegate_4006Text(View view) {
		Delegate domainModelElement = (Delegate) view.getElement();
		if (domainModelElement != null) {
			return domainModelElement.getName();
		} else {
			ComponentBasedSystemDiagramEditorPlugin.getInstance().logError(
					"No domain element for view with visualID = " + 4006); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getCompositeComponent_2002Text(View view) {
		IParser parser = ComponentBasedSystemParserProvider.getParser(
				ComponentBasedSystemElementTypes.CompositeComponent_2002, view
						.getElement() != null ? view.getElement() : view,
				ComponentBasedSystemVisualIDRegistry
						.getType(CompositeComponentNameEditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			ComponentBasedSystemDiagramEditorPlugin.getInstance().logError(
					"Parser was not found for label " + 5012); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getInterface_3003Text(View view) {
		IParser parser = ComponentBasedSystemParserProvider.getParser(
				ComponentBasedSystemElementTypes.Interface_3003, view
						.getElement() != null ? view.getElement() : view,
				ComponentBasedSystemVisualIDRegistry
						.getType(InterfaceName2EditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			ComponentBasedSystemDiagramEditorPlugin.getInstance().logError(
					"Parser was not found for label " + 5005); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getUnknownElementText(View view) {
		return "<UnknownElement Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$  //$NON-NLS-2$
	}

	/**
	 * @generated
	 */
	private String getUnresolvedDomainElementProxyText(View view) {
		return "<Unresolved domain element Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$  //$NON-NLS-2$
	}

	/**
	 * @generated
	 */
	public void init(ICommonContentExtensionSite aConfig) {
	}

	/**
	 * @generated
	 */
	public void restoreState(IMemento aMemento) {
	}

	/**
	 * @generated
	 */
	public void saveState(IMemento aMemento) {
	}

	/**
	 * @generated
	 */
	public String getDescription(Object anElement) {
		return null;
	}

	/**
	 * @generated
	 */
	private boolean isOwnView(View view) {
		return ModelEditPart.MODEL_ID
				.equals(ComponentBasedSystemVisualIDRegistry.getModelID(view));
	}

}
